fix: make built-in tool injection configurable#167
Conversation
Every ToolManager instance automatically copies the global tool registry, so agents that should not have spatial or communication capabilities (e.g., static entities in a dining philosophers simulation) still receive move_one_step, teleport_to_location, and speak_to. Add include_builtins parameter to ToolManager (default True for backward compatibility). When False, the manager starts with an empty tool set so only explicitly provided tools are available. Also add remove_tool() for fine-grained per-instance removal and expose include_builtin_tools on LLMAgent.__init__ for convenience.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #167 +/- ##
==========================================
+ Coverage 90.08% 90.09% +0.01%
==========================================
Files 19 19
Lines 1503 1505 +2
==========================================
+ Hits 1354 1356 +2
Misses 149 149 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Fixes #90
Every
ToolManagerinstance automatically copies the global tool registry (_GLOBAL_TOOL_REGISTRY), so all agents receivemove_one_step,teleport_to_location, andspeak_toregardless of whether those capabilities make sense for the agent. This causes:Changes
tool_manager.py:include_builtinsparameter toToolManager.__init__()(defaultTruefor full backward compatibility)False, the manager starts with an empty tool set — onlyextra_tools(if provided) are registeredremove_tool(name)method for fine-grained per-instance tool removalllm_agent.py:include_builtin_toolsparameter toLLMAgent.__init__()that passes through toToolManagerTests (5 new):
test_include_builtins_false_starts_empty— verifies no global tools when disabledtest_include_builtins_true_includes_global_tools— verifies default behavior preservedtest_include_builtins_false_with_extra_tools— verifies only extras are availabletest_remove_tool— verifies removal workstest_remove_tool_missing_is_silent— verifies no error on missing toolUsage Example
Test Plan
include_builtins=True)